/**
 * 入参
    type： 1- 指令   2-簿记
    onOk：指令下达成功或簿记成功抛出事件
    onCancel：取消抛出事件

*/
import React, { PropTypes, PureComponent, Fragment } from 'react';
import { PrimaryC, AvailableAssetC, TradeHoldC, AdvancedSearch, FirstHeaderC, SecondHeaderC, PrimaryGhostC } from '../../../../comps';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { Row, Col, Card, Tabs, Input, Spin, Button, message, Table, Divider, DatePicker, Select, Modal } from 'antd';
import style from './index.less';
import DaZongBondFormC from '../../BondTradeNew/orderComps/daZongBond2/daZongBondForm';
import DaZongBondFormC2 from '../../BondTradeNew/orderComps/daZongBond/daZongBondForm';
import Trade0 from '../TradForm1/ZqTradingCode/index'; // 交易所债券指令
import Trade1 from '../TradForm1/bankBond/index'; //
import Trade2 from '../TradForm1/SjExchangeStock/index';
const confirm = Modal.confirm;
import { connect } from 'dva';
import 'moment/locale/zh-cn';
import moment from 'moment';
const { TabPane } = Tabs;
@Form.create()
@connect(({ bondTradeM, userM: user, loading }) => ({
  bondTradeM,
  user,
  loading,
}))
export default class BondTradeDetailC extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {};
  }

  componentDidMount() {}

  UNSAFE_componentWillReceiveProps(nextProps) {}

  render() {
    const { info, type } = this.props;
    const props = {
      type: 3,
      info: info,
    };
    const initComp = (key) => {
      if (key === '0') return <Trade0 {...props} businessType={key} />;
      if (key === '1') return <Trade1 {...props} businessType={key} />;
      if (key === '2') return <Trade2 {...props} businessType={key} />;
      if (key === '3') return <DaZongBondFormC2 {...props} businessType={key} />;
      if (key === '25') return <DaZongBondFormC {...props} businessType={key} />;
    };
    return (
      <div>
        {initComp(info.type)}
        {type == 'jiaoshou' ? (
          <div className={style.btnOperate}>
            <PrimaryC
              title={'交收确认'}
              onClick={() => {
                this.props.jiaosouClick();
              }}
            />
            <PrimaryGhostC
              title={'取消'}
              onClick={() => {
                this.props.onCancel();
              }}
            />
          </div>
        ) : null}
      </div>
    );
  }
}
